local skel = fk.CreateSkill{
  name = "lb__xingyou",
  max_branches_use_time = {
    ["round"] = {
      [Player.HistoryRound] = 1
    },
  }
}

Fk:loadTranslationTable{
  ["lb__xingyou"] = "星佑",
  --[":lb__xingyou"] = "每阶段限一次，你摸牌后，你可以将一张牌置于牌堆顶并卜算3。",
  --9.7
  --[":lb__xingyou"] = "每回合限一次，你摸牌后，你可以将一张牌置于牌堆顶并卜算3。",
  --[":lb__xingyou"] = "每轮限一次，你摸牌后，你可以将一张牌置于牌堆顶并卜算3。",
  --9.18
  [":lb__xingyou"] = "每轮限一次，你摸牌后，你可以将这些牌置于牌堆顶并卜算3。",
  --[":lb__xingyou"] = "每轮限一次，你摸牌后，你可以将其中一张牌置于牌堆顶并卜算3。",

  ["#lb__xingyou"] = "星佑：你可以将这些牌置于牌堆顶并卜算3",

  ["$lb__xingyou1"] = "星辰会铭记我们的名字。",
  ["$lb__xingyou2"] = "一切都是星辰的选择。",
}

skel:addEffect(fk.AfterCardsMove, {
  anim_type = "control",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(skel.name) and player:usedSkillTimes(skel.name, Player.HistoryRound, "round") < 1 and not player:isNude() then
      for _, move in ipairs(data) do
        if move.to == player and move.moveReason == fk.ReasonDraw then
          local cards = {}
          for _, info in ipairs(move.moveInfo) do
            if info.fromArea == Card.DrawPile then
              table.insert(cards, info.cardId)
              --return true
            end
          end
          if #cards > 0 then
            event:setCostData(self, {cards = cards})
            return true
          end
        end
      end
    end
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    --[[
    local cards = room:askToCards(player, {
      min_num = 1,
      max_num = 1,
      skill_name = skel.name,
      include_equip = true,
      cancelable = true,
      prompt = "#lb__xingyou",
      pattern = tostring(Exppattern {id = event:getCostData(self).cards }),
    })
    if #cards > 0 then
      event:setCostData(self, {cards = cards})
      return true
    end
    --]]
    ---[[
    return room:askToViewCardsAndChoice(player, {
      cards = event:getCostData(self).cards,
      skill_name = skel.name,
      choices = { "OK", "Cancel" },
      prompt = "#lb__xingyou",
    }) == "OK"
  --]]
  end,
  on_use = function(self, event, target, player, data)
    player:addSkillBranchUseHistory(skel.name, "round")
    local room = player.room
    local cards = event:getCostData(self).cards
    room:moveCards({
      ids = table.reverse(cards),
      from = player,
      toArea = Card.DrawPile,
      moveReason = fk.ReasonPut,
      skillName = skel.name,
      proposer = player,
    })
    room:askToGuanxing(player, { cards = room:getNCards(3) })
  end,
}, { check_skill_limit = true})

return skel